package com.hyt.it.ogt.kq.service.gov.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hyt.core.base.BaseServiceImpl;
import com.hyt.it.ogt.kq.service.gov.mapper.TimeExaminerMapper;
import com.hyt.it.ogt.kq.service.gov.model.entity.TimeExaminer;
import com.hyt.it.ogt.kq.service.gov.service.ITimeExaminerService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 批次考务人员表 服务实现类
 * </p>
 *
 * @author wangg
 * @since 2021-12-01
 */
@Service
public class TimeExaminerServiceImpl extends BaseServiceImpl<TimeExaminerMapper, TimeExaminer> implements ITimeExaminerService {

    @Override
    public List<TimeExaminer> getByTime(String taskId, String timeId, String type, String examinerIds) {
        return baseMapper.getByTime(taskId, timeId, type, examinerIds);
    }

    @Override
    public List<TimeExaminer> getByALLByTime(String taskId, String timeId) {
        return baseMapper.selectList(new LambdaQueryWrapper<TimeExaminer>()
                .eq(TimeExaminer::getTaskId, taskId)
                .eq(TimeExaminer::getTimeId, timeId)
        );
    }

    @Override
    public void insertByBatchByTime(List<TimeExaminer> examinerList) {
        saveBatch(examinerList);
    }

    @Override
    public void deleteByTask(String taskId) {
        QueryWrapper<TimeExaminer> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(TimeExaminer::getTaskId, taskId);
        remove(queryWrapper);
    }

}
